package com.sharker.utils;

import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.sharker.R;

/**
 * 作者：郭传沛 on 2017/4/12 20:00
 * 邮箱：bestyourselfgcp@163.com
 * 类用途:
 */

public class BaseTitlebar extends RelativeLayout {

    private final TextView mName;
    private final ImageView mImage;

    public BaseTitlebar(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        View view = LayoutInflater.from(context).inflate(R.layout.title_bar, this);
        mName = (TextView) view.findViewById(R.id.title_text);
        mImage = (ImageView) view.findViewById(R.id.title_img);
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.basetitle);
        if (typedArray != null) {
            String string = typedArray.getString(R.styleable.basetitle_basetitle_name);
            mName.setText(string);
        }
    }

}
